package cn.iocoder.yudao.module.resource.dal.mysql.gamematches;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.resource.controller.admin.gamematches.vo.GameMatchesPageReqVO;
import cn.iocoder.yudao.module.resource.dal.dataobject.gamematches.GameMatchesDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 对局记录 Mapper
 *
 * @author lizhongwen
 */
@Mapper
public interface GameMatchesMapper extends BaseMapperX<GameMatchesDO> {

    default PageResult<GameMatchesDO> selectPage(GameMatchesPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<GameMatchesDO>()
                .eqIfPresent(GameMatchesDO::getMatchId, reqVO.getMatchId())
                .likeIfPresent(GameMatchesDO::getTitle, reqVO.getTitle())
                .eqIfPresent(GameMatchesDO::getUserId, reqVO.getUserId())
                .eqIfPresent(GameMatchesDO::getRoleId, reqVO.getRoleId())
                .betweenIfPresent(GameMatchesDO::getFinishedAt, reqVO.getFinishedAt())
                .eqIfPresent(GameMatchesDO::getExtension, reqVO.getExtension())
                .betweenIfPresent(GameMatchesDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(GameMatchesDO::getMatchId));
    }

}